RDKEMW-22317 : Integrate VIPA widget 1.4.4.5 with nativescript - #138
RDKEMW-22317 : Integrate VIPA widget 1.4.4.5 with nativescript#138gurpreet319 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the JS runtime networking utilities to support integrating VIPA widget v1.4.4.5 with NativeScript, focusing on improving XMLHttpRequest behavior and expanding URLSearchParams compatibility.
Changes:
- Refactors
XMLHttpRequest.open()/send()to reset internal state more safely, parse URLs via the WHATWGURLAPI, and harden request/redirect handling. - Updates auth header creation to use
Buffer.fromand improves event dispatching to pass an event object to handlers/listeners. - Extends
URLSearchParamsconstruction to accept additional init shapes and adds iteration APIs (forEach,entries,keys,values).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| utils/xhr.js | XHR state reset, URL parsing + request option construction, redirect handling, transport validation, and event dispatch behavior updates. |
| src/jsc/modules/lib/URLSearchParams.js | Broader constructor input support and added iteration/utility methods (forEach/entries/keys/values). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
b'## WARNING: A Blackduck scan failure has been waived A prior failure has been upvoted
|
Reason for change: Integrate VIPA 1.4.4.5 with nativescript, updated the xhr and URLSearchParams. Test Procedure: build should be successful Risk: low Priority: P2
52de8a5 to
2cec2d1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (2)
utils/xhr.js:405
- Redirect handling reuses the original request headers and always ends the redirected request without re-sending the original body. This can produce incorrect redirects for non-GET requests (e.g., POST redirects sending Content-Length/Content-Type but no body), and 303 redirects should also switch the stored method to GET for any subsequent redirects.
var redirectOptions = {
hostname: redirectUrl.hostname,
host: redirectUrl.hostname,
port: redirectPort,
path: redirectUrl.pathname + (redirectUrl.search || ""),
protocol: redirectSsl ? "https:" : "http:",
ssl: redirectSsl,
method: response.statusCode === 303 ? "GET" : settings.method,
headers: headers,
withCredentials: self.withCredentials
};
src/jsc/modules/lib/URLSearchParams.js:171
- entries() currently returns the internal _list iterator, which exposes the backing tuple arrays to callers. That allows external mutation of tuples without triggering _updateSteps() and can desync URLSearchParams from its associated URL. Consider returning an iterator that yields copied [name, value] arrays instead.
entries() {
return this._list[Symbol.iterator]();
}
|
Hi @mhughesacn, can you please review it |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (3)
src/jsc/modules/lib/URLSearchParams.js:211
- Symbol.iterator currently returns the internal _list iterator. Delegating to entries() keeps iteration semantics consistent across APIs and avoids exposing internal pair arrays.
[Symbol.iterator]() {
return this._list[Symbol.iterator]();
}
utils/xhr.js:11
- The header removed the original MIT license/attribution lines. Since this file is derived from third-party MIT-licensed code, the attribution/license notice should be retained for compliance.
* Usage: include("XMLHttpRequest.js") and use XMLHttpRequest per W3C specs.
* Original code by DeFelippi.
* Some modifications by Comcast.
*
*/
src/jsc/modules/lib/URLSearchParams.js:171
- entries() currently returns the internal _list array iterator, which exposes the mutable internal pair arrays to callers (mutating an iterated pair would mutate URLSearchParams state). Returning an iterator that yields copied [name, value] pairs better matches platform behavior and avoids unexpected side effects.
This issue also appears on line 209 of the same file.
entries() {
return this._list[Symbol.iterator]();
}
Reason for change: Integrate VIPA 1.4.4.5 with nativescript, updated the xhr and URLSearchParams.
Test Procedure: build should be successful
Risk: low
Priority: P2